package org.record.mood.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.record.mood.bean.About;
import org.record.mood.bean.AboutExample;
import org.record.mood.bean.Nav;
import org.record.mood.bean.NavExample;
import org.record.mood.common.RecordConst;
import org.record.mood.dao.AboutMapper;
import org.record.mood.dao.NavMapper;
import org.record.mood.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: sunyw
 * @time: 2020-04-16 9:57
 */
@Service
@Slf4j
public class NavServiceImpl implements NavService {
    @Autowired
    private NavMapper navMapper;
    @Autowired
    private AboutMapper aboutMapper;

    @Override
    public List<Nav> indexNav() {
        NavExample navExample = new NavExample();
        navExample.createCriteria().andNavstatusEqualTo(RecordConst.status.RELEASE);
        return navMapper.selectByExample(navExample);
    }

    @Override
    public About about() {
        AboutExample aboutExample = new AboutExample();
        aboutExample.createCriteria().andStatusEqualTo(RecordConst.status.RELEASE);
        List<About> abouts = aboutMapper.selectByExample(aboutExample);
        return abouts.get(0);
    }
}
